/************************************************************************/
/*    Author: Scott Bevin                                               */
/************************************************************************/

#pragma once

#include "OctTreeNode.h"

namespace XF
{
	class OctTree
	{
	private:
		OctTreeNode *mRootNode;

	public:
		OctTree(OctTree &copyTree);
		OctTree(float x, float y, float z, float width, float height, float depth, int targetObjects, int maxHeirachyDepth);
		~OctTree();

		/**
		this function will add an object into the tree, subdividing if necessary and possible
		*/
		bool AddBody(Body* body){ return mRootNode->AddBody(body); }

		/**
		remove object will remove an object and unnecessary nodes
		*/
		bool RemoveBody(Body* body){ return mRootNode->RemoveBody(body);}

		OctTreeNode* Root(){ return mRootNode; }

		/**
		counts the number of objects held by the tree from this node downwards, this one uses the iterator to count, 
		enabling a test for whether it works yarrrrrrrrrrrrrrrrr
		*/
		int GetNoOfObjects();
		
		int TargetObjects(){ return mRootNode->TargetObjects(); }
		int MaxDepth(){ return mRootNode->MaxDepth(); }
	};
}